<template>
    <div class="container">
        <div class="navbar" v-for="items in sendContent" @click="changeRouter(items.rpath)">
            <div class="navbar-title">{{items.barTitle}}</div>
            <div class="navbar-bar" v-show="(path===`${items.rpath}`)"></div>
        </div>
    </div>
</template>

<script>

export default {
    name: "sendRecord",
    methods:{
        changeRouter(path){
            this.$router.push(path);
        }
    },
    data(){
        return {
            sendContent:[
                {
                    barTitle:'进行中',
                    rpath:'/loading'
                },
                {
                    barTitle:'已寄出',
                    rpath:'/finished'
                },
                {
                    barTitle:'已取消',
                    rpath:'/canceled'
                },
            ],
            path:'/loading',
        };
    },
    watch:{
        $route(to,from){
            this.path=to.path;
        },
        immediate:true
    }
}
</script>

<style lang="scss" scoped>
    .container{
        box-shadow: 0px 10px 10px #e3e3e3;
        line-height: 80px;
        display: flex;
        justify-content: space-around;
        align-items: center;
        background-color: white;
        .navbar{
            text-align: center;
            position: relative;
            &-title{
                font-size: 30px;
            }
            &-bar:after{
                content: '';
                left: -5px;
                position: absolute;
                width: 100px;
                height: 5px;
                border-radius: 10px;
                background-color: #0072ff;
            }
        }
    }
</style>